<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
  mixins: [
    Vue.prototype.$vFN.Mixins.Base,
    Vue.prototype.$vFN.Mixins.Page,
    Vue.prototype.$vFN.Mixins.Table,
  ],
  components: {},
  data() {
    return {
      appWindow: window,
      // 页面接口地址
      apiUrl: {
        list: "mall-site-portal/download-center/list",
        delete: "mall-site-portal/download-center/delete",
      },

      // 列表高级查询参数
      mixinTable_tableSearchSenior: {
        // 业务模块
        module: {
          type: Number,
          value: null,
          default: null,
        },

        // 状态
        status: {
          type: Number,
          value: null,
          default: null,
        },

        // 开始时间
        createdTimeStartStr: {
          type: String,
          value: null,
          default: null,
        },
        // 结束时间
        createdTimeEndStr: {
          type: String,
          value: null,
          default: null,
        },
      },

      mixinTable_tableSearchData: {
        name: "",
      },
      tableDeleteConfig: {
        width: "400px",
        title: "确认删除?",
        columns: [
          {
            label: "数据类型名称",
            prop: "name",
            type: "",
          },
        ],
      },
    };
  },
  methods: {
    // 初始化
    async init() {
      // 刷新表格数据，此方法扩展时可重写
      this.mixinTable_refreshData();
    },

    downloadFile(item_) {
      let url_ = item_.downloadUrl;
      let alink = document.createElement("a");

      // alink.download = `${item_.name}.zip`; //文件名,大部分浏览器兼容,IE10及以下不兼容

      alink.href = url_; //创建 url地址

      alink.click(); //自动点击
    },

    startChange(date_) {
      this.init();
    },
    endChange(date_) {
      this.init();
    },

    // 状态转文字
    status2Text(num_) {
      let text = "";
      switch (num_) {
        case 1:
          text = "生成中";
          break;
        case 2:
          text = "已完成";
          break;
        case 3:
          text = "生成失败";
          break;
      }
      return text;
    },

    // 业务模块转文字
    module2Text(num_) {
      let text = "";
      switch (num_) {
        case 1:
          text = "商品";
          break;
        case 2:
          text = "会员";
          break;
        case 3:
          text = "订单";
          break;
      }
      return text;
    },
  },
  watch: {},
  mounted() {
    this.init();
  },
  activated() {},
};
</script>
